public class Test {
    public static void main(String[] args) {
        int[] arr ={1,1,2};
        Solution.removeDuplicates(arr);
    }
}
class Solution {
    public static int removeDuplicates(int[] nums) {
        int p1 = 0;
        int p2 = 0;
        int p3 = 1;
        while (p3 < nums.length) {
            while (nums[p2] == nums[p3]) {
                p3++;
                if (p3 >= nums.length) return p1 + 1;
            }
            nums[++p1] = nums[p3];
            p2 = p3;
            p3++;
        }
        return p1 + 1;
    }
}
